package com.holly.unit.bpmn.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 审批模式枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/5/7 8:41
 */
public enum ApprovalModeEnum {

    // 会签
    COUNTER_SIGN("counterSign"),
    // 或签
    OR_SIGN("orSign"),
    // 依次
    NEXT_SIGN("next");

    String fieldName;

    ApprovalModeEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static ApprovalModeEnum of(String fieldName) {
        return Stream.of(ApprovalModeEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(COUNTER_SIGN);
    }


}
